FUNCTION DEFINITION

     FLUID is a subroutine that calculates thermodynamic and
transport properties of pure fluid substances.  The thermodynamic
state may be determined from assigned values of temperature and
density, pressure and density, temperature and pressure, pressure
and entropy, or pressure and enthalpy.  Fluid conditions may be
liquid, two-phase or gaseous.  A van der Waals model is used to
obtain approximate state values; these values are then corrected
for real-gas effects by model-correction factors obtained from
tables based on experimental data.  Saturation conditions,
specific heat, entropy and enthalpy are included in the tables for
each fluid.  Since these tables (contained in the initializing
subroutine) are external to the FLUID subroutine, FLUID can be
used for any fluid if it has a set of tables.  Refer to NASA TM X-
3572 and existing tables to generate tables for other fluids.
This version of FLUID functions as that written by Theodore E.
Fessler in SFTRAN, but has been converted to standard FORTRAN 77.

METHOD OF SOLUTION

     The method of solution is the same as that found in Theodore
E.  Fessler's paper "FLUID: A Numerical Interpolation Procedure
for Obtaining Thermodynamic and Transport Properties of Fluids."
Refer to NASA TM X-3572.

ENVIRONMENT CHARACTERISTICS

     This version of FLUID was verified on Microsoft's FORTRAN 77
version 3.3 for use on an IBM PC.  An IBM PC-AT was used to
develop the program, and the program should be operational on any
PC compatible computer.  Storage of 128 Kbytes of memory should be
sufficient to run the program.  A math co-processor is not
necessary but is desirable due to the number of computations
performed.  FLUID and its supporting files can be transported via
360 Kb double sided, double density, soft sectored, MS-DOS/PC-DOS
compatible diskette.

     Although FLUID was developed on Microsoft's FORTRAN 77, it
should be compatible with any other standard FORTRAN 77.  FLUID
should also run on any mainframe computer with standard FORTRAN
77.  FLUID can be made available on tape upon request.  The
following instructions will only address the environment of
Microsoft's FORTRAN 77 installed on an IBM PC. However,
installations on other environments are encouraged.

IMPLEMENTATION INSTRUCTIONS

     FLUID and its accompanying subroutines occupy much storage
space.  Preferably, the FORTRAN 77 compiler and FLUID can be
installed on a hard disk.  If a hard disk is not available, the
programs can still be run from diskettes, but the operation is
much slower.

     The following files are provided for installation:

COMPILE.BAT   CLINK.BAT    FLUIDS1.LIB  FLUIDS2.LIB  FLUIDS3.LIB
FLUID.FOR     NTRP.FOR     CUBIC.FOR    STEAM.FOR    INSTR.ASC
SAMPLE.FOR    AR.FOR       CH4.FOR      CO2.FOR      DRYAIR.FOR
F2.FOR        N2.FOR       O2.FOR       PH2.FOR

COMPILE.BAT and CLINK.BAT are batch files provided as example
batch files for compiling and linking programs.  The batch
commands should be altered to accommodate the user's environment.
FLUIDS1.LIB contains the compiled modules of O2.FOR, STEAM.FOR,
DRYAIR.FOR, PH2.FOR, and CO2.FOR.  FLUIDS2.LIB contains the
compiled modules of AR.FOR, N2.FOR, CH4.FOR, NTRP.FOR, CUBIC.FOR,
and FLUID.FOR.  FLUIDS3.LIB contains the compiled module of
F2.FOR.  The user's main program must be compiled and linked to
these libraries.  If the user wishes to add another fluid to a
library, one of the existing initializing subroutines should be
used as a model to create a new initializing subroutine for the
fluid desired.  This new subroutine should be compiled and then
added to a library using the library creation commands on the
user's particular FORTRAN 77 compiler.

INSTRUCTIONS FOR USING "FLUID"

     FLUID is a fluid properties subroutine; to use it, a main
program must be written.  The following declaration statements
must be placed at the beginning of the main program:

     1.  DIMENSION G(29,4),TT(27),DD(30),GG(27,30,8),
                   SAT(40,8),C(8),M(4)

     2.  INTEGER ENTRY,ERROR

     3.  LOGICAL VAPOR

     4.  COMMON/FLUIDC/ GAMMA,WL,WG,DENSL,DENSG,ENTL,ENTG,
                        ENTHL,ENTHG

     5.  COMMON/FLUDPC/ G,TT,DD,GG,SAT,C,M,NG,N1,N2,N3,NS

NOTE:  Common block FLUIDC contains the thermodynamic properties
for saturated gas and liquid.

     The variables for the desired fluid must be initialized
before calling FLUID in the main program. Use:

               CALL O2 for oxygen
               CALL PH2 for hydrogen
               CALL NITRO for nitrogen
               CALL AR for argon
               CALL F2 for fluorine
               CALL STEAM for steam
               CALL DRYAIR for dry air
               CALL CH4 for methane
               CALL CO2 for carbon dioxide

FLUID may be called as many times as necessary once it is
initialized. If another fluid is needed, reinitialize for that
fluid.  The call statement for FLUID is

CALL FLUID(TEMP,PRES,DENS,PROPS,NP,ENTRY,VAPOR,ERROR,IGOTO)

     where

     TEMP= fluid temperature, same units as TC
     PRES= fluid pressure, same units as PC
     DENS = fluid density, same units as DC.
     PROPS = other fluid properties:
       PROPS(1) = compressibility, PRES/(R*DENS*TEMP).
       PROPS(2) = entropy, same units as R.
       PROPS(3) = enthalpy, same units as R*TC.
       PROPS(4) = specific heat, CV, same units as R.
       PROPS(5) = specific heat, CP, same units as R.
       PROPS(6) = sonic velocity, same units as SQRT(R*TC).
       PROPS(7) = viscosity, GRAMS/CM-SEC
       PROPS(8) = thermal conductivity, WATTS/CM-K

NOTE:  The units of PC, TC, DC, and R are listed at the top of
each fluid initializing subroutine.

     NP = number of properties to be calculated.
     ENTRY = integer that specifies which variables are input:
           = 1 if temperature and density are given.
           = 2 if pressure and density are given.
           = 3 if temperature and pressure are given.
           = 4 if pressure and entropy are given.
           = 5 if pressure and enthalpy are given.
     VAPOR = .TRUE. if the fluid is saturated. In that case,
             values of liquid and gas phases are given in the
             COMMON BLOCK /FLUIDC/.
     ERROR = error flags (BITS -- least significant = 1):
             ** if ERROR = 0,  all is well **
             BIT 1 = out of range in SAT table.
             BIT 2 = out of range in G table.
             BIT 3 = out of range in TT table.
             BIT 4 = out of range in DD table.
             BIT 5 = convergence not achieved in solving inverse
                     function.
     IGOTO = 1 calls FLUID
           = 2 calls FLUIDL
           = 3 calls FLUIDG
           = 4 calls FLUIDO

     To determine the calling arguments, answer these questions:

     1.  What two properties will be used to define the state of
         the fluid?

         Select a combination listed under ENTRY. Property values
         may be placed directly into the call statement or defined
         before the call statement.  If any defining property is
         PROPS(1) thru PROPS(8), it must be defined before the
         call statement.

     2.  Which properties are desired as output?

         NP must be set to the highest PROPS(I) desired.  For
         example, if PROPS(1) and PROPS(5) are the desired output
         then NP = 5.

         If transport properties for saturated liquid are desired,
         then CALL FLUID with IGOTO=2.

         If transport properties for saturated gas are desired,
         then CALL FLUID with IGOTO=3.

     It is probably wise to check ERROR after each CALL FLUID to
verify that the conditions requested were within the range of the
data tables.  Fatal error messages are written to file 6, which
must be opened prior to calling FLUID.

     An example of a main program that uses FLUID has been written
and is called SAMPLE.  The following is a terminal listing of
compiling SAMPLE, linking it to FLUIDS1.LIB, FLUIDS2.LIB and
FLUIDS3.LIB and executing SAMPLE:

C>COMPILE SAMPLE

C>ECHO OFF

Microsoft FORTRAN77 V3.30 March 1985
(C) Copyright Microsoft Corp 1982, 1983, 1984, 1985

Pass One    No Errors Detected
           155 Source Lines

Code Area Size = #09CE  ( 2510)
Cons Area Size = #0171  (  369)
Data Area Size = #0686  ( 1670)

Pass Two     No Errors Detected.

C>




C>CLINK SAMPLE

C>\FTNDIR\LINK SAMPLE,,,FORTRAN.LIB+MATH.LIB+FLUIDS1.LIB
+FLUIDS2.LIB+FLUIDS3.LIB;

Microsoft 8086 Object Linker
Version 3.02 (C) Copyright Microsoft Corp 1983, 1984, 1985

C>ECHO Enter SAMPLE to execute this program.
Enter SAMPLE to execute this program.
C>SAMPLE
ENTER:P(PSIA),T(R),S(BTU/LBM-R),H(BTU/LBM),RHO(LBM/CU FT),KPROP(1-
9),ENTRY(1-5)
100.,500., , , ,7,3
File name missing or blank - Please enter name
UNIT 6? OUTPUT
Stop - Program terminated.

C>


     The output data from SAMPLE will be located in the file
called OUTPUT.  OUTPUT contains:

                                   INPUT DATA:
  P=       100.0000000 T  =       500.0000000 S    =.0000000
  H=          .0000000 RHO=          .0000000 ENTRY=            3
 DRYAIR


                                  OUTPUT DATA:
 P=  100.     PSI                      T=  500.     R
 COMPRESSIBILITY          .996
 ENTROPY(BTU/LBM-R)       1.59
 ENTHALPY(BTU/LBM)        271.
 DENSITY(LBM/FT3)         .541
 CV(BTU/LBM-R)            .172
 CP(BTU/LBM-R)            .243
 CP/CV                    1.41
 SONIC VELOCITY(FT/S)     .110E+04
 VISCOSITY(LBM/FT-S)      .117E-04
 THERM.COND.(BTU/FT-S-R)  .394E-05

The source code for SAMPLE follows:

                                                                                                                                                                                                                                                                                                                                                                                                                                 